package Menus
{
	import flash.display.Bitmap;
	import Utils.Key;
	
	public class PauseMenu extends BaseMenu
	{			
		public function PauseMenu(game:Game, bitmap:Bitmap)
		{
			super(game, bitmap);
			this.name = "Pause";
			this.visible = false;
			this.maxChoices = 4;
			this.bitmap.x = (game.TopClass.stage.stageWidth - this.bitmap.width) / 2;
			this.bitmap.y = (game.TopClass.stage.stageHeight - this.bitmap.height) / 2;
			testOutput.text = "Unpause Game";
			this.addChild(testOutput);
		}
		
		public override function HandleInput(keyCode:uint):void
		{
			switch(keyCode)
			{
				case Key.P:
					this.Hide();
					game.UnPauseGame();
					break;
				case Key.UP:
					if(MenuChoice == 0)
					{
						MenuChoice = maxChoices - 1;
					}
					else
					{
						MenuChoice--;
					}
					break;
					break;
				case Key.DOWN:
					if(MenuChoice == maxChoices - 1)
					{
						MenuChoice = 0;
					}
					else
					{
						MenuChoice++;
					}
					break;
				case Key.ENTER:
					switch(menuChoice)
					{
						case 0:
							this.Hide();
							game.UnPauseGame();
							break;
						case 1:
							this.Hide();
							this.SwitchMenus("Main");
							break;
						case 2:
							this.Hide();
							this.SwitchMenus("LevelSelection");
							break;
						case 3:
							this.Hide();
							this.SwitchMenus("Inventory");
							break;
					}
					break;
			}
		}
		
		protected override function menuChoiceChanged():void
		{
			switch(menuChoice)
			{
				case 0:testOutput.text = "UnPause Game";break;
				case 1:testOutput.text = "Main Menu";break;
				case 2:testOutput.text = "Level Selection";break;
				case 3:testOutput.text = "Inventory";break;
			}
		} 
	}
}